package sg.edu.nus.iss.phoenix.schedule.delegate;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.TreeMap;

import sg.edu.nus.iss.phoenix.schedule.entity.Schedule;
import sg.edu.nus.iss.phoenix.schedule.service.ScheduleService;
import sg.edu.nus.iss.phoenix.utils.DateHolder;
/**
 * Schedule Delegate. This class calls the service to invoke an action.
 * 
 * @author Low  Kheng Hian (A0092668N)
 * @author Nang Sai Hom (A0092617B)
 *  
 * @version 1.0 2012/9/27
 */
public class ScheduleDelegate {
/**
		 * Insert Schedule  
		 * 
		 * @param schedule Schedule object
		 * @return
		 */
       
	public void insertSchedule(Schedule schedule) {
		ScheduleService service = new ScheduleService();
		service.insertScehdule(schedule);
	}

/**
	 * Update Schedule  
	 * 
	 * @param schedule Schedule object
	 * @return
	 */
    
	public void updateSchedule(Schedule schedule) {
		ScheduleService service = new ScheduleService();
		service.updateScehdule(schedule);
	}


	/**
	 * Delete Schedule  
	 * 
	 * @param schedule Schedule object
	 * @return
	 */
	public void deleteSchedule(Schedule schedule) {
		ScheduleService service = new ScheduleService();
		service.deleteScehdule(schedule);
	}

	/**
	 * Find all schedule
	 * 
	 * @return List of schedule object
	 */ 
	
	public ArrayList<Schedule> findAllSchedule() {
		ScheduleService service = new ScheduleService();
		return service.findAllSchedule();

	}
   
/**
	 * Find all schedule by Date
	 * 
	 * @return List of schedule object
	 */ 
	
	public ArrayList<Schedule> findAllSchedule(Date date) {
		ScheduleService service = new ScheduleService();
		return service.findAllSchedule(date);
	}
	
   /**
	 * Copy schedule
	 * 
	 * @return schedule object
	 */ 
	public Schedule copySchedule(Schedule schedule){
		ScheduleService service = new ScheduleService();
		return service.copySchedule(schedule);
	}

	/**
	 * Load Schedule by schedule object
	 * 
	 * @return schedule object
	 */ 
    
	public Schedule loadSchedule(Schedule schedule) {
		ScheduleService service = new ScheduleService();
		return service.loadSchedule(schedule);
	}
   
	/**
	 * Find available slots by date
	 * 
	 * @return schedule object
	 */ 
	public TreeMap<Integer, DateHolder> findAvailableSlots(Date date) {
		ScheduleService service = new ScheduleService();
		return service.findAvailableSlots(date);
	}
	
	

}
